package com.palm.dev.common;


import java.sql.Types;

public class ZdmDataTypes {
    public static final int STRING = 1;
    public static final int BLOB = 2;
    public static final int BIGDECIMAL = 3;
    public static final int DECIMAL = 4;
    public static final int FLOAT = 5;
    public static final int DOUBLE = 6;
    public static final int LONG = 7;
    public static final int INTEGER = 8;
    public static final int SMALLINT = 9;
    public static final int CLOB = 10;
    public static final int BIT = 11;
    public static final int DATETIME = 12;
    public static final int OBJECT = 13;

    public static String toSqlType(int type){
        switch (type) {
            case DATETIME:
                return "DATE";
            case STRING:
                return "VARCHAR";
            case CLOB:
                return "CLOB";
            case BLOB:
                return "BLOB";
            case BIGDECIMAL:
                return "DECIMAL";
            case FLOAT:
                return "FLOAT";
            case DECIMAL:
                return "DECIMAL";
            case DOUBLE:
                return "DOUBLE";
            case LONG:
                return "BIGINT";
            case INTEGER:
                return "INTEGER";
            case SMALLINT:
                return "SMALLINT";
            case BIT:
                return "BIT";
            case OBJECT:
                return "BLOB";
        }
        return "Object";
    }
    public static String toJavaType(int type) {

        switch (type) {
            case DATETIME:
                return "Date";
            case STRING:
            case CLOB:
                return "String";
            case BLOB:
                return "byte[]";
            case BIGDECIMAL:
            case FLOAT:
            case DECIMAL:
            case DOUBLE:
                return "BigDecimal";
            case LONG:
                return "Long";
            case INTEGER:
                return "Integer";
            case SMALLINT:
            case BIT:
                return "Boolean";
            case OBJECT:
                return "Object";
        }
        return "Object";
    }

    public static String toString(int type) {
        switch (type) {
            case DATETIME: {
                return "DateTime";
            }
            case STRING: {
                return "String";
            }
            case BLOB: {
                return "BLOB";
            }
            case BIGDECIMAL: {
                return "BigDecimal";
            }
            case DECIMAL: {
                return "Decimal";
            }
            case FLOAT: {
                return "Float";
            }
            case DOUBLE: {
                return "Double";
            }
            case LONG: {
                return "Long";
            }
            case INTEGER: {
                return "Integer";
            }
            case SMALLINT: {
                return "SmallInt";
            }
            case CLOB: {
                return "Clob";
            }
            case BIT: {
                return "Bit";
            }
        }
        return "Unknown";
    }
}
